package com.gitee.wsl.net.client.apiclient

import com.gitee.wsl.net.client.apiclient.request.RemoteRequest
import com.gitee.wsl.net.client.apiclient.request.RemoteRequestImpl
import com.gitee.wsl.net.client.apiclient.request.RequestInterceptor
import com.gitee.wsl.net.client.apiclient.request.ResponseInterceptor
import io.ktor.client.*

fun createRequest(
    baseUrl: String,
    requestInterceptors: List<RequestInterceptor>,
    responseInterceptors: List<ResponseInterceptor>,
    client: HttpClient?,
): RemoteRequest = RemoteRequestImpl(
    baseUrl,
    requestInterceptors,
    responseInterceptors,
    client,
)

/**
 * Creates a remote request
 */
fun createRequest(
    config: ApiClient.Config,
) = createRequest(
    baseUrl = config.baseUrl,
    requestInterceptors = config.requestInterceptors,
    responseInterceptors = config.responseInterceptors,
    client = config.client,
)
